Git and GitHub: tools for collaborative work and reproducible projects

true , true
2021-11-04

Introduction

The main objective of the seminar is to become familiar with the automated version control system Git and the remote repository GitHub.

Both tools are gaining more importance in the daily workflows of many researchers and university courses (e.g., STAT 545 course at the University of British Columbia, https://stat545.stat.ubc.ca/)

In this seminar we will learn how Git can be used to track changes to projects or files and how this version control is especially useful in collaborative projects through the use of hosting services such as GitHub. Understand their logic, functionality and power so that anyone can then explore them further.

Specifically we will learn:

  1. The benefits of using an automated version control system

  2. The advantages of integrating version control and hosting services

  3. The basic workflow for using Git and GitHub from RStudio

For example, Git and GitHub can help us solve some everyday versioning problems that can be a bit of a nuisance:

- Overwriting a file

- Infinite final versions

“FINAL.doc”

- Mistakenly worked on a non-final version

- Creating “conflicting” copies when two people work at the same time

- Editions without tracking changes

Ediciones sin control de cambios

Seminar structure

Introduction
What is Git
What is Github
Repositories & projects
Workflow in Git & GitHub
Branches
Some interesting links

What is Git

Git terminal

Terminal

Though RStudio

What is GitHub

GitHub homepage
GitHub profile

Repositories & projects

A repository is like a “container” in which to develop a project

GitHub repository

Workflow in Git & GitHub

There are four working areas (trees):

  1. Working directory: where you are working. This tree is synchronised with the local files on your PC

  2. Staging area: the intermediate zone between the working directory and the local repository. It is the draft zone. It records changes that are specified in the directory. It is also called Index

  3. Local repository: where all changes of your PC are stored. It is also called HEAD

  4. Remote repository: where all changes are stored in the cloud

Different working areas in Git and GitHub
Workflow in Git y GitHub

Branches

Branch merging process

Some interesting links

Fire emergency


Session Info

[1] "2021-11-04 16:10:39 CET"
git2r::repository()
Local:    main C:/Users/julen/OneDrive - Universidad de Alcala/GitHub-collaborations/intro_git-github
Remote:   main @ origin (https://github.com/Julenasti/intro_git-github.git)
Head:     [0ea01cc] 2021-10-17: revert html
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

loaded via a namespace (and not attached):
 [1] digest_0.6.27     R6_2.5.0          jsonlite_1.7.2   
 [4] git2r_0.28.0      magrittr_2.0.1    evaluate_0.14    
 [7] stringi_1.5.3     rlang_0.4.11      jquerylib_0.1.4  
[10] bslib_0.2.5.1     rmarkdown_2.8     distill_1.2      
[13] tools_4.0.5       stringr_1.4.0     xfun_0.22        
[16] yaml_2.2.1        compiler_4.0.5    htmltools_0.5.1.1
[19] knitr_1.33        downlit_0.2.1     sass_0.4.0